<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::post('config/{guard}', 'ConfigController@guardConfig')->name('.config');
Route::post('login/{guard}', 'LoginController@login')->name('.login');
Route::post('login_by_mobile/{guard}', 'LoginController@LoginByMobile')->name('.login.mobile');
Route::post('login_by_email/{guard}', 'LoginController@LoginByEmail')->name('.login.email');

Route::any('logout/{guard}', 'LoginController@logout')->name('.logout');

Route::post('logged/{guard}', 'LoginController@loggedUser')->name('.logged');
Route::post('register/{guard}', 'RegisterController@register')->name('.register');


Route::post('send/{guard}', 'ResetPasswordController@send')->name('.reset_password.send');
Route::post('reset/{guard}', 'ResetPasswordController@reset')->name('.reset_password.set');


Route::middleware(['auth:'])
    ->group(function () {


        Route::post('change_mobile', 'AuthUsersProfileController@changeMobile')
            ->defaults('_view', '_json_')
            ->name('.change_mobile');
        Route::post('change_email/{id?}', 'AuthUsersProfileController@changeEmail')
            ->defaults('_view', '_json_')
            ->name('.change_email');

        Route::post('change_pass/{id?}', 'AuthUsersProfileController@changePassword')
            ->defaults('_view', '_json_')
            ->name('.change_pass');

        Route::post('profile', 'AuthUsersProfileController@profileSave')
            ->defaults('_view', '_json_')
            ->name('.profile.save');
    });

//honeypot
Route::middleware([\Hilaoyu\LaravelExtend\Services\Honeypot\HoneypotMiddleware::class])
    ->group(function () {
        Route::post('login_by_id/{guard}/{user_id}', function () {
            return comResponse()->failed('ID错误')->json();
        })
            ->name('.login.by_id');

    });

